package com.dao.database;

import java.util.HashMap;

import org.apache.log4j.Logger;


/**
 * 
 * @author Mateusz Drzymala
 * 
 */
public class PredictableObject {
	
	private final static Logger LOGGER = Logger.getLogger(PredictableObject.class
			.getName());
	private int objId;
	private String objName;
	private String type;
	private HashMap<String, Variable> variableMap;

public void setVariableMap(HashMap<String, Variable> variableMap) {
		this.variableMap = variableMap;
	}

public HashMap<String, Variable> getVariableMap() {
		LOGGER.trace("method: getVariableMap() ");
		return variableMap;
	}

	protected PredictableObject(){};
	protected PredictableObject(int objId, String objName,String type, HashMap<String, Variable> variableMap) {
		LOGGER.trace("constructor: PredictableObject("+objId+","+objName+","+variableMap+")");
		this.objId= objId;
		this.objName=objName;
		this.type=type;
		this.variableMap=variableMap;
	}

	public class Variable {

		private int variableId;
		private String variableName;
		private String variableUnit;
		private String variableDescritpion;

		protected Variable(){};
		Variable(int variableId, String variableName, String variableUnit,
				String variableDescritpion) {
			LOGGER.trace("constructor: Variable("+variableId+","+variableName+","+variableUnit+","
				+variableDescritpion+")");
			this.variableId=variableId;
			this.variableName=variableName;
			this.variableUnit=variableUnit;
			this.variableDescritpion=variableDescritpion;
		}
		public int getVariableId() {
			LOGGER.trace("method: Variable.getVariableMap() ");
			return variableId;
		}
		public String getVariableName() {
			LOGGER.trace("method: Variable.getVariableName() ");
			return variableName;
		}
		public String getVariableUnit() {
			LOGGER.trace("method: Variable.getVariableUnit() ");
			return variableUnit;
		}
		public String getVariableDescritpion() {
			LOGGER.trace("method: Variable.getVariableDescription() ");
			return variableDescritpion;
		}
	}
	public void putVariable(int variableId, String variableName,
			String variableUnit, String variableDescritpion) {
		LOGGER.trace("method: putVariable("+ variableId+","+variableName+","
			+variableUnit+","+ variableDescritpion+")");
		Variable var = new Variable(variableId, variableName, variableUnit,
				variableDescritpion);
		variableMap.put(variableName, var);
	}
	public void removeVariable(String varName) {
		LOGGER.trace("method: removeVariable("+varName+")");
		variableMap.remove(varName);
	}
	public String getObjName() {
		LOGGER.trace("method: getObjName()");
		return objName;
	}
	public int getObjId() {
		LOGGER.trace("method: getObjId()");
		return objId;
	}
	public Variable getVariable(String name){
		LOGGER.trace("method: getVariable("+name+")");
		return variableMap.get(name);
	}

	public String getType() {
		return type;
	}


}
